package com.example.ppjoke;

import android.view.LayoutInflater;
import android.view.View;

import com.example.adapter_sdk.quick.BaseQuickAdapter;
import com.example.adapter_sdk.quick.BaseQuickMoreAdapter;
import com.example.adapter_sdk.quick.BaseViewHolder;

public class MoreAdapter extends BaseQuickMoreAdapter<MoreEntity> {
    public MoreAdapter() {
        addItemChildClick(R.id.more_title_tv);
        addItemChildClick(R.id.more_value_tv);
    }


    @Override
    public void convert(BaseViewHolder holder, MoreEntity item) {
        if(item.type == 0){
            holder.setText(R.id.more_title_tv,item.title);
        }else {
            holder.setText(R.id.more_value_tv,item.value);
        }
    }

    @Override
    protected View createItemView(int viewType) {
        if (viewType == 0){
            View titleView = LayoutInflater.from(context).inflate(R.layout.item_more,null,false);
            return titleView;
        }else {
            View valueView = LayoutInflater.from(context).inflate(R.layout.item_more_img,null,false);
            return valueView;
        }
    }

    @Override
    public int getItemType(int position) {
        return getData().get(position).type;
    }
}
